<template>
  <!--          create Notice dialogue     *************************************** -->
  <el-dialog
    :title="createNoticeRemark.title"
    :visible="isVisible"
    :before-close="hide"
  >
    <el-form ref="createNoticeValue" :model="createNoticeValue" label-width="120px">
      <el-form-item :label="createNoticeRemark.title">
        <el-input v-model="createNoticeValue.title" />
      </el-form-item>
      <el-form-item :label="createNoticeRemark.content">
        <el-input 
        type="textarea"
        :rows="3"
        v-model="createNoticeValue.content" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="createNotice">创建</el-button>
        <el-button @click="hide">取消</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
<script>
export default {
  props: {
    isVisible: {
      type: Boolean,
      required: false,
      default: false,
    },
  },
  data() {
    return {
      createNoticeValue: {
        approverId: "",
        type: "",
        totalMoney: "",
        interestRate: "0.4",
        createdTime: "",
        url: "/basic/notice/add",
      },
      createNoticeRemark: {
        title: "主题",
        content: "内容"
      },
    };
  },
  created() {},
  methods: {
    createNotice() {
      this.$store.dispatch("request/post", this.createNoticeValue).then(() => {
        this.$message.success("通知发布成功!!");
        this.$emit("updateData");
      });
    },
    hide() {
      this.$emit("hide");
    },
  },
};
</script>